﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AsterNET.FastAGI.Command;

namespace AsterNET.Extensions.FastAGI.Helpers
{

    public class FaxOptions
    {
        /// <summary>
        /// Enable FAX debugging
        /// </summary>
        /// <returns></returns>
        public static string EnableDebug()
        {
            return "d";
        }

        /// <summary>
        /// Allow audio fallback FAX transfer on T.38 capable channels.
        /// </summary>
        /// <returns></returns>
        public static string AllowAudioFailback()
        {
            return "f";
        }

        /// <summary>
        /// Send progress Manager events (overrides statusevents setting in res_fax.conf).
        /// </summary>
        /// <returns></returns>
        public static string SendManagerEvents()
        {
            return "s";
        }
    }
    public class ReceiveFaxHelper
    {

        /// <summary>
        /// <para>Receive a FAX and save as a TIFF/F file.</para>
        /// <para>This application is provided by res_fax, which is a FAX technology agnostic module that utilizes FAX technology resource modules to complete a FAX transmission. Session arguments can be set by the FAXOPT function and to check results of the ReceiveFax() application.</para>
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public static ExecCommand ReceiveFax(string filename, params string[] options)
        {
            var opts = String.Join(",", options);
            
            string rtn = string.Format("{0},{1}",
                filename, opts);

            return new ExecCommand("ReceiveFax", rtn);
        }

    }
}
